#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-

import sys, os

def build(bld):
    if bld.env['LICENSE'] == 'gpl':
        elfInclude = '../libbfd_objloader/bfdFrontend'
    else:
        elfInclude = '../libelf_objloader/bfdFrontend'

    uselib_custom = ''
    cppflags_custom = ''
    if sys.platform == 'cygwin':
        cppflags_custom = ' -D__USE_W32_SOCKETS'
        uselib_custom = ' WINSOCK'

    bld.objects(source='GDBConnectionManager.cpp',
        includes = '. ' + elfInclude + ' ../utils ..',
        use = 'SYSTEMC BOOST BOOST_REGEX BOOST_THREAD' + uselib_custom,
        target = 'debugger',
        install_path = None,
        defines = cppflags_custom
    )

    bld.install_files(os.path.join(bld.env.PREFIX, 'include'), 'GDBStub.hpp GDBConnectionManager.hpp BreakpointManager.hpp WatchpointManager.hpp')
